get directory name of path c#

85

get directory name of path c# -

string filename = @"C:/folder1/folder2/file.txt";
string FolderName = new DirectoryInfo(System.IO.Path.GetDirectoryName(filename)).Name;

Comments

Submit
0 Comments